﻿<%@ Page Title="" Language="C#" MasterPageFile="~/AdminMaster.master" AutoEventWireup="true" CodeBehind="MailConfig.aspx.cs" Inherits="doris.Admin.MailConfig" %>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:Panel ID="Panel1" runat="server" CssClass="twoCol">
    <h2>Pop3</h2>
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
        DataKeyNames="ConfigurationMailID" DataSourceID="SqlDataSource1" CssClass="dorisGrid" AlternatingRowStyle-CssClass="alt">
        <Columns>
            <asp:BoundField DataField="ConfigurationMailID" 
                HeaderText="ConfigurationMailID" InsertVisible="False" ReadOnly="True" 
                SortExpression="ConfigurationMailID" Visible="False" />
            <asp:TemplateField HeaderText="ConnectionName" SortExpression="ConnectionName">
                <ItemTemplate>
                    <asp:HyperLink runat="server" NavigateUrl='<%# "~/Admin/POP3Edit.aspx?id=" + Eval("ConfigurationMailID") %>'><asp:Label ID="Label1" runat="server" Text='<%# Bind("ConnectionName") %>'></asp:Label></asp:HyperLink>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Enabled" SortExpression="Enabled">
                <ItemTemplate>
                    <asp:CheckBox ID="cbEnabled" runat="server" Checked='<%# Convert.ToBoolean(Eval("Enabled")) %>' />
                    <asp:HiddenField ID="Enabled" runat="server" Value='<%# Bind("Enabled") %>' />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:CommandField ShowDeleteButton="True" />
        </Columns>
        <EmptyDataTemplate>
            Ingen pop3
        </EmptyDataTemplate>
    </asp:GridView>
    <asp:HyperLink ID="HyperLink1" runat="server" 
        NavigateUrl="~/Admin/POP3Edit.aspx">Legg til ny</asp:HyperLink>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:localConnectionString %>" 
        ProviderName="<%$ ConnectionStrings:localConnectionString.ProviderName %>" 
        SelectCommand="getAllPop3" SelectCommandType="StoredProcedure" 
            DeleteCommand="deleteMail" DeleteCommandType="StoredProcedure" 
            ondeleting="SqlDataSource1_Deleting">
        <DeleteParameters>
            <asp:Parameter Name="in_configurationmailid" Type="Int32" />
        </DeleteParameters>
        </asp:SqlDataSource>
    </asp:Panel>
    <asp:Panel ID="Panel2" runat="server" CssClass="twoCol">
    <h2>SMTP</h2>
    <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" 
        DataKeyNames="ConfigurationMailID" DataSourceID="SqlDataSource2" CssClass="dorisGrid" AlternatingRowStyle-CssClass="alt">
        <Columns>
            <asp:BoundField DataField="ConfigurationMailID" 
                HeaderText="ConfigurationMailID" InsertVisible="False" ReadOnly="True" 
                SortExpression="ConfigurationMailID" Visible="False" />
            <asp:TemplateField HeaderText="ConnectionName" SortExpression="ConnectionName">
                <ItemTemplate>
                    <asp:HyperLink ID="HyperLink3" runat="server" NavigateUrl='<%# "~/Admin/SMTPEdit.aspx?id=" + Eval("ConfigurationMailID") %>'><asp:Label ID="Label1" runat="server" Text='<%# Bind("ConnectionName") %>'></asp:Label></asp:HyperLink>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Enabled" SortExpression="Enabled">
                <ItemTemplate>
                    <asp:CheckBox ID="cbEnabled" runat="server" Checked='<%# Convert.ToBoolean(Eval("Enabled")) %>' />
                    <asp:HiddenField ID="Enabled" runat="server" Value='<%# Bind("Enabled") %>' />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:CommandField ShowDeleteButton="True" />
        </Columns>
        <EmptyDataTemplate>
            Ingen smtp
        </EmptyDataTemplate>
    </asp:GridView>
    <asp:HyperLink ID="HyperLink2" runat="server" 
        NavigateUrl="~/Admin/SMTPEdit.aspx">Legg til ny</asp:HyperLink>
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
        ConnectionString="<%$ ConnectionStrings:localConnectionString %>" 
        ProviderName="<%$ ConnectionStrings:localConnectionString.ProviderName %>" 
        SelectCommand="getAllSmtp" SelectCommandType="StoredProcedure" 
            DeleteCommand="deleteMail" DeleteCommandType="StoredProcedure" 
            UpdateCommand="addCustomer" UpdateCommandType="StoredProcedure" ondeleting="SqlDataSource1_Deleting">
        <DeleteParameters>
            <asp:Parameter Name="in_configurationmailid" Type="Int32" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="in_email" Type="String" />
            <asp:Parameter Name="in_fullname" Type="String" />
            <asp:Parameter Name="in_password" Type="String" />
            <asp:Parameter Name="in_adress" Type="String" />
            <asp:Parameter Name="in_postcode" Type="Int32" />
            <asp:Parameter Name="in_companyid" Type="Int32" />
            <asp:Parameter Name="in_ticketpriorityid" Type="Int32" />
            <asp:Parameter Direction="InputOutput" Name="inout_username" Type="String" />
        </UpdateParameters>
        </asp:SqlDataSource>
    </asp:Panel>
    <br />
    <div style="clear: both">
    <asp:HyperLink ID="HyperLink4" runat="server" 
        NavigateUrl="~/Admin/Default.aspx">Tilbake</asp:HyperLink>
    </div>
    
</asp:Content>